import produce from 'immer';
import {Action, LanSetting} from 'types';

export interface SettingsState {
  locale: LanSetting;
}
export const initialState: Readonly<SettingsState> = {locale: 'en'};

export default (originalState = initialState, action: Action) =>
  produce(originalState, (state) => {
    switch (action.type) {
      case 'setLocale':
        state.locale = action.payload;
    }
  });
